home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / userlib.com / USERLIB.DOC next >
Encoding:
Text File  |  1989-11-29  |  4.5 KB  |  143 lines

  1. Unit UserLib;
  2. interface
  3.   uses crt,dos;
  4. type
  5.   MenuList = Array[0..9] of String[40];
  6. const
  7.   HexChars : Array[1..16] of Char =
  8.     ('0','1','2','3','4','5','6','7',
  9.      '8','9','A','B','C','D','E','F');
  10. {keyboard constants}
  11. {ASCII   Dec            Description}
  12.   NUL  = #000; {CTRL @  Null}
  13.   SOH  = #001; {CTRL A  Start of header}
  14.   STX  = #002; {CTRL B  Start of text}
  15.   ETX  = #003; {CTRL C  End of text}
  16.   EOT  = #004; {CTRL D  End of transmission}
  17.   ENQ  = #005; {CTRL E  Enquiry}
  18.   ACK  = #006; {CTRL F  Acknowledge}
  19.   BEL  = #007; {CTRL G  Bell}
  20.   BS   = #008; {CTRL H  Backspace}
  21.   TAB  = #009; {CTRL I  Horizontal tab}
  22.   LF   = #010; {CTRL J  Line Feed}
  23.   VT   = #011; {CTRL K  Vertical tab}
  24.   FF   = #012; {CTRL L  Form feed}
  25.   CR   = #013; {CTRL M  Carriage return}
  26.   SO   = #014; {CTRL N  Shift out}
  27.   SI   = #015; {CTRL O  Shift in}
  28.   DLE  = #016; {CTRL P  Data link escape}
  29.   DC1  = #017; {CTRL Q  Dev. control 1 (XON)}
  30.   DC2  = #018; {CTRL R  Dev. control 2}
  31.   DC3  = #019; {CTRL S  Dev. control 3 (XOFF)}
  32.   DC4  = #020; {CTRL T  Dev. control 4}
  33.   NAK  = #021; {CTRL U  Negative acknowledge}
  34.   SYN  = #022; {CTRL V  Synchronous idle (SYNC)}
  35.   ETB  = #023; {CTRL W  End of transmission block}
  36.   CAN  = #024; {CTRL X  Cancel}
  37.   EM   = #025; {CTRL Y  End of medium}
  38.   SUB  = #026; {CTRL Z  Substitute}
  39.   ESC  = #027; {CTRL [  Escape}
  40.   FS   = #028; {CTRL \  File seperator}
  41.   GS   = #029; {CTRL ]  Group seperator}
  42.   RS   = #030; {CTRL ^  Record seperator}
  43.   US   = #031; {CTRL _  Unit seperator}
  44. { #032 to #0126 are normal ASCII characters}
  45. { DEL  = #127; (Delete/Rubout) }
  46. {translated extended codes
  47.  codes above 127 are not generated directly from keyboard
  48.  they are translations of the actual 2 character sequence
  49.  (NUL xx) obtained by adding 128 to the xx character}
  50.   F1   = #187;
  51.   F2   = #188;
  52.   F3   = #189;
  53.   F4   = #190;
  54.   F5   = #191;
  55.   F6   = #192;
  56.   F7   = #193;
  57.   F8   = #194;
  58.   F9   = #195;
  59.   F10  = #196;
  60.   HOMEKEY  = #199;
  61.   UPKEY    = #200;
  62.   PGUPKEY  = #201;
  63.   LEFTKEY  = #203;
  64.   RIGHTKEY = #205;
  65.   ENDKEY   = #207;
  66.   DOWNKEY  = #208;
  67.   PGDNKEY  = #209;
  68.   INSKEY   = #210;
  69.   DELKEY   = #211;
  70.   CTRLLEFTKEY  = #243;
  71.   CTRLRIGHTKEY = #244;
  72. var
  73.   Back,Txt: byte; Field: integer;
  74.  
  75. procedure Abort(msg:String);
  76. {display message and halt}
  77.  
  78. procedure Beep;
  79. {sound beeper}
  80.  
  81. procedure CursorType(S:char);
  82. {set cursor to B-Block, U-Underline or O-Off}
  83.  
  84. procedure ClrLine(Col,Row:byte);
  85. {clear line to spaces on crt}
  86.  
  87. procedure Display_Int(Col,Row,Txt,Back:byte; Rev:Boolean;
  88.                       I:integer; Width:byte);
  89. { Writes an integer on screen at Col,Row, possibly reverse video}
  90.  
  91. procedure Display_Real(Col,Row,Txt,Back:byte; Rev:Boolean;
  92.                        R:real; Width,Dec:byte);
  93. { Writes a real number on screen at Col,Row, possibly reverse video}
  94.  
  95. procedure Display_Str(Col,Row,Txt,Back:byte; Rev:Boolean;
  96.                       S:String);
  97. { Writes a string on screen at Col,Row, possibly reverse video}
  98.  
  99. function Exists(FileName : String) : Boolean;
  100. { Returns True if the file FileName exists, False otherwise }
  101.  
  102. function GetHex(Decimal_Value:Word):string;
  103. {convert value to Hex string for display}
  104.  
  105. procedure Inp_Int(Col,Row,Txt,Back:byte;
  106.                   var I:integer; Max:byte);
  107. {Input an integer up to max digits from screen at Col,Row}
  108.  
  109. procedure Inp_Real(Col,Row,Txt,Back:byte;
  110.                    var R:real; Max,Frac:byte);
  111. {Input a real number from screen - Max chars (including sign & decimal point)
  112.  with up to Frac decimal places}
  113.  
  114. procedure Inp_Str(Col,Row,Txt,Back:byte;
  115.                       var S:String; Max:byte; Shift:char);
  116. {Input a string from screen at Col,Row in a reverse video box}
  117.  
  118. function KeyInp : Char;
  119. { Reads the next keyboard character, translates special keys }
  120.  
  121. procedure Menu(var Items: MenuList; var Choice: integer;
  122.                   Max,Txt,Back:byte);
  123. {display a list of items and return selection
  124.  Parameters are Items - array of items to display
  125.                 Choice - number of item chosen
  126.                 Max - number of items
  127.                 Txt - Text Color
  128.                 Back - Background Color}
  129.  
  130. procedure Message(Msg:String);
  131. {display msg on line 23 and pause}
  132.  
  133. function PadStr(S:string; L:byte; C:char; J:char):string;
  134. {pad string S to length L with character C justified J('R' or 'L')}
  135.  
  136. procedure Pause;
  137. {print message on line 24 and wait for input}
  138.  
  139. function PurgeCh(InS:string; C:char):string;
  140. {delete all occurences of C from S}
  141.  
  142. function Yes_No(Prompt:string):char;
  143. {print message on line 24 and wait for input}